
<%@ page import="auctionatr.Category" %>
<%@ page import="auctionatr.Auction" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'category.label', default: 'Category')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
    </head>
    <body>
    	
        <div class="body">
            <h1><g:message code="category.anzeigen.label" args="[entityName]" />:
			${fieldValue(bean: categoryInstance, field: "name")}</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
        
        <div class="list">
			<table>
				<thead>
					<tr>

						<th>
							${message(code: 'auction.name.label', default: 'Name')}
						</th>

						<th>
							${message(code: 'auction.description.label', default: 'Description')}
						</th>

						<th>
							${message(code: 'auction.finishDate.label', default: 'Finish Date')}
						</th>

						<th>
							${message(code: 'auction.startPrice.label', default: 'Start Price')}
						</th>

						<th>
							${message(code: 'auction.highestBid.label', default: 'Highest Bid')}
						</th>

						<th>
							${message(code: 'auction.isFinished.label', default: 'is finished?')}
						</th>

					</tr>
				</thead>
				<tbody>
				
					<g:each in="${auctionInstanceList}" status="i"
						var="auctionInstance">
						<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

							<td><g:link controller="auction" action="show"
									id="${auctionInstance[0]}">
									${auctionInstance[1]}
								</g:link>
							</td>

							<td>
								${auctionInstance[2]}
							</td>

							<td><g:formatDate format="${message(code: 'default.date.format', default: 'DateFormat')}"
									date="${auctionInstance[3]}" />
							</td>

							<td><g:formatNumber number="${auctionInstance[4]}"
									type="currency" currencyCode="EUR" />
							</td>

							<td><g:if test="${auctionInstance[5] != null}"><g:formatNumber number="${auctionInstance[5]}"
									type="currency" currencyCode="EUR" />
								</g:if>
								<g:else>
								<g:formatNumber number="${auctionInstance[4]}"
									type="currency" currencyCode="EUR" />
								</g:else>	
							</td>
									
									
							<td><g:if test="${auctionInstance[3] < new Date()}">
									<g:link controller="auction" action="report">
										<g:message code="auction.auktionsliste.reportLink.label"
											default="Show Report" />
									</g:link>
								</g:if> <g:else>-</g:else>
							</td>



						</tr>
					</g:each>
				</tbody>
			</table>
		</div>    
            
            <div class="paginateButtons">
                <g:paginate total="${auctionInstanceTotal}" params="[id: params?.id]" />
                    
            </div>
        </div>
    </body>
</html>
